import cv2


def test1():
    img = cv2.imread('sheet.png')
    print(len(img))

    # 设置截取区域的左上角坐标(x, y)和区域的宽度与高度(w, h)
    x, y, w, h = 95, 95, 3222 - 95, 2250 - 95
    print(y + h)
    # 根据坐标截取图像
    copy = img[y:y + h, x:x + w]

    cv2.imwrite("copy1.png", copy)


def test2():
    #
    img = cv2.imread('copy1.png')

    #
    top_x, top_y, bottom_x, bottom_y = 252, 797, 470, 827
    #
    copy = img[top_y:bottom_y, top_x:bottom_x]

    #
    cv2.imwrite("copy2.png", copy)
